package homework;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;



public class java01 {
	public static void main(String[] args) throws Exception {
		BufferedReader br=new BufferedReader(new FileReader("sort.txt"));
		String line;
		HashMap<Integer, String> map=new HashMap<>();
		ArrayList<Integer> arr=new ArrayList<>();
		while((line=br.readLine())!=null){
			String[] str=line.split("\\.");
			arr.add(Integer.parseInt(str[0]));
			map.put(Integer.parseInt(str[0]), str[1]);
		}
		br.close();
		Collections.sort(arr);
		BufferedWriter bw=new BufferedWriter(new FileWriter("sort.txt"));
		Set<Entry<Integer, String>> entrySet = map.entrySet();
		for (Entry<Integer, String> entry : entrySet) {
			bw.write(entry.getKey()+"."+entry.getValue());
			bw.newLine();
			bw.flush();
		}
		bw.close();
	}
}
